/******************************************************************************
KenoGuts.h: interface for the KenoGuts class.

Copyright 2005 Realtime Gaming.  All rights reserved.
******************************************************************************/
#if !defined(_KENOGUTS_H_)
#define _KENOGUTS_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "GameGuts.h"

/******************************************************************************
Forward Declarations
******************************************************************************/
class KenoBet;
class KenoCard;
class KenoGame;
class KenoPayout;
class KenoSQL;

/******************************************************************************
class KenoGuts - Implements Keno-specific logic for the GameConnection class
******************************************************************************/
class KenoGuts  : public GameGuts
{
    typedef GameGuts super;

public:     //Nested Types & enums
    enum
    {
        MAX_SERVER_PICKS = 20,
        MAX_PICK = 80
    };
    typedef struct 
    {
        uint8	m_picks[MAX_SERVER_PICKS];
        int32	m_payout;
    }GAMERESULT;

public:     //Methods
	KenoGuts(GameConnection*);
	virtual ~KenoGuts();
    
	void	gameDone();

public:     //Overridden Virtuals
    uint8   getGameID() const { return 13; };
    uint8   getMachineID() const { return 0; };
    int32   getMinBet() const;
    int32   getMaxBet() const;
    uint8   getMaxCards() const;
    uint8   getMaxGames() const;

    uint8   getPaytable() const;
	int32	getDenomValue(int32 index) const;
	bool8   isValidDenom(int32 denom) const;

    void    processBet(uint8* buf, 
                       int32 len, int32 num_cards, 
                       int32 num_games);

    int32   getPlayerLimits(const PID& pid, int32* compFactor);
	int32	getDenominations();

    void    sendSavedGame();

#ifdef FORCED_KENO
	void	loadForcedResults();
#endif

protected:      //Methods    
    bool8   playGame (KenoCard& card, int32 numgames, bool8 newGroup,
                    GAMERESULT& gresult, int32& balance);
    
    bool8   trackNewGame(KenoBet *bet, int32 *Balance, 
                         int32 numGames, bool8 newGroup) const;
    bool8   trackGameDone(int32 BalAdjust, int32* Balance, 
                          int32 *results) const;
    uint8   trackGetPayTable() const;

protected:      //Data
    static const uint8 MaxGames;
    static const uint8 MaxCards;
	int32 MinBet;
	int32 MaxBet;

    KenoGame*     m_game;
    KenoPayout*   m_paytable;
    KenoSQL*      m_tracker;

};

#endif // !defined(_KENOGUTS_H_)
